﻿package smooth.core.object.youTubeVideoComponent {
	import app.core.object.VideoObject;
	import smooth.core.object.youTubeComponent.YouTubeVideoObject;
	import caurina.transitions.Tweener;	
	
	public class YouTubeVideoComponent extends YouTubeVideoPlayer {
		private var youTubeVideoObject:YouTubeVideoObject;
		private var initialWidth:int;
		private var initialHeight:int;
		private var initialPosX:int;
		private var initialPosY:int;
		private var initialColor:int;
		private var initialScale:Number;
				
		public function YouTubeVideoComponent(devKey:String, name:String, youTubeVideoObject:YouTubeVideoObject, posX:int, posY:int, scale:Number) {
			// Init des attributs de l'objet
			this.name = name;
			this.youTubeVideoObject = youTubeVideoObject;
			this.initialPosX = posX;
			this.initialPosY = posY;
			this.initialScale = scale;
			// Appel du constructeur parent
			var id:String = youTubeVideoObject.getId();
			super(id, devKey);
			// Init des visuels du composant			
			initGraphics();
			// Init des events du composant
			initEvents();	
			// Init des process du composant
			initProcess();
		}
		
		private function initGraphics():void {
			this.scaleX = initialScale;
			this.scaleY = initialScale;
			this.x = initialPosX;
			this.y = initialPosX;
		}
		
		private function initProcess():void {
		}
		
		private function initEvents():void {
		}
		
		public function doAnimationFadeIn(maxWidth:int, maxHeight:int ):void {
			Tweener.addTween(this, { x:(Math.random()*maxWidth),y:(Math.random()*maxHeight), time:3, transition:"easeInOutBack" } );	
		}
		
	}
	
}